const arr = [1,2,2,3,3,4,5,5,6];

/** 方案1 */
console.log(new Set(arr));
/** 方案2 */
console.log(arr.filter((item,index) => arr.indexOf(item) === index));
/** 方案3 */
console.log(arr.reduce((prev,cur) => prev.includes(cur) ? prev : [...prev, cur] ,[]));

/** 方案4 */
function noRepeat(arr){
    for (let i = 0;i < arr.length; i++) {
        if(arr.indexOf(arr[i]) !== i) {
            arr.splice(i,1)
            i--;
        }
    }  
    return arr;
}
console.log(noRepeat(arr));

/** 方案5 */
function unique(arr) {
 var res = [];
 for(var i = 0,arrayLen = arr.length;i<arrayLen;i++){
    for(var j=0,resLen=res.length;j<resLen;j++){
        if(arr[i] === res[j]){
            break;
        }
    }
    if(resLen === j){
        res.push(arr[i]);
    }}
    return res;
}
console.log(arr);